package ch05_类与对象;

public class Person {
	String name;
	int age;
	String id;
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public int getAge() {
		return age;
	}
	public void setAge(int age) {
		this.age = age;
	}
	public String getId() {
		return id;
	}
	public void setId(String id) {
		this.id = id;
	}
	void sleep(int minutes){
		System.out.println("睡 "+minutes+"分钟...");
	}
	Person(String _name){
		name=_name;
		id="10010019990101000x";
	}
	Person(String name,int age,String id){
		this.name=name;
		this.age=age;
		this.id=id;
	}
	@Override
	public String toString() {
		return "Person2 [name=" + name + ", age=" + age + ", id=" + id + "]";
	}
	public static void main(String[] args) {
		Person person1=new Person("李华",18,"1000099");
		Person person2=new Person("Mary");
		System.out.println(person1.toString());
		System.out.println(person2.toString());
		
	}
}
